from typing import Union
from core.basic.mcharacter import Character
from core.basic.mskill import ActiveSkill,PassiveSkill

class Skill0(PassiveSkill):
    id = 0
    name = '魔法暴击'
    icon = '/character/common/22.png'
    requiredLv = 10
    masterLv = 10
    maxLv = 20
    rangeLv = 3
    damageType = '魔法'

    def effect(self, char:Character,addLv = 0):
        if self.lv > 0:
            if addLv == 0:
                char.SetStatus(魔暴P = 0.01 * self.lv)
            else:
                char.SetStatus(魔暴P = 0.01 * addLv)


class Skill1(ActiveSkill):
    id = 1
    name = "光电鳗"
    icon = '/character/mage_female/common/Common.img_0_11.png'
    requiredLv = 5
    CD = 3
    masterLv = 50
    maxLv = 60
    SP = 15
    data0 = [0] + [int(88 + 9 * (i-1)) for i in range(0, 60)]
    hit0 = 3
    ElementA = {'光': True}
    damageType = '魔法'

    TPCost = 1
    growthTP = 0.02
    masterTPLv = 5
    maxTPLv = 7

# 普通攻击
# 292
# 292
# 626
# 跳跃 360

class Skill2(ActiveSkill):
  name = '冰霜雪人'
  icon = '/character/mage_female/common/Common.img_0_6.png'
  requiredLv = 10
  rangeLv = 2
  masterLv = 50
  maxLv = 60
  CD = 5
  SP = 20
  data0 = [0] + [int(489 + 45.15 * (i-1)) for i in range(0,60)]
  hit0 = 1
  ElementA = {'冰': True}
  damageType = '魔法'

  TPCost = 1
  growthTP  = 0.02
  masterTPLv = 5
  maxTPLv = 7

class Skill3(ActiveSkill):
    name = '龙牙'
    icon = '/character/mage_female/common/Common.img_0_8.png'
    requiredLv = 5
    rangeLv = 2
    masterLv = 50
    maxLv = 60
    CD = 3
    SP = 15
    data0 = [0] + [int(384 + 39 * (i-1)) for i in range(0, 60)]
    hit0 = 1
    damageType = '物理'

    TPCost = 1
    growthTP = 0.02

class Skill4(ActiveSkill):
    name = '圆舞棍'
    icon = '/character/mage_female/common/Common.img_0_13.png'
    requiredLv = 5
    rangeLv = 2
    masterLv = 50
    maxLv = 60
    minLv = 1
    CD = 5
    SP = 20
    data0 = [0] + [int(407 + 41 * (i-1)) for i in range(0, 60)]
    hit0 = 1
    data0 = [0] + [int(407 + 41 * (i-1)) for i in range(0, 60)]
    hit0 = 1

    damageType = '物理'

    TPCost = 1
    growthTP = 0.02
    masterTPLv = 5
    maxTPLv = 7

class Skill5(ActiveSkill):
    name = '天击'
    icon = '/character/mage_female/common/Common.img_0_16.png'
    requiredLv = 10
    rangeLv = 2
    masterLv = 1
    maxLv = 1
    CD = 5
    SP = 20
    data0 = [0,170]
    hit0 = 1
    damageType = '物理'

class Skill6(ActiveSkill):
    name = '杰克爆弹'
    icon = '/character/mage_female/common/Common.img_0_4.png'
    requiredLv = 5
    rangeLv = 2
    masterLv = 50
    maxLv = 60
    minLv = 1
    CD = 5
    SP = 20
    data0 = [0] + [int(240 + 25 * (i-1)) for i in range(0,60)]
    hit0 = 1
    ElementA = {'火': True}
    damageType = '魔法'
    # 蓄力30%增伤
    skillRatio = 1.3

    TPCost = 1
    growthTP  = 0.02
    masterTPLv = 5
    maxTPLv = 7

class Skill7(ActiveSkill):
    name = '暗影夜猫'
    icon = '/character/mage_female/common/Common.img_0_15.png'
    requiredLv = 5
    rangeLv = 2
    masterLv = 50
    maxLv = 60
    minLv = 1
    CD = 5
    SP = 20
    data0 = [0] + [int(172 + 17 * (i-1)) for i in range(0,60)]
    hit0 = 1
    ElementA = {'暗': True}
    damageType = '魔法'

    TPCost = 1
    growthTP  = 0.02
    masterTPLv = 5
    maxTPLv = 7

class Skill8(ActiveSkill):
    name = '落花掌'
    icon = '/character/mage_female/common/Common.img_0_14.png'
    requiredLv = 10
    rangeLv = 2
    masterLv = 50
    maxLv = 60
    CD = 5
    SP = 20
    data0 = [0] + [int(453 + 46 * (i-1)) for i in range(0,60)]
    hit0 = 1

    damageType = '物理'

    TPCost = 1
    growthTP = 0.02
    masterTPLv = 5
    maxTPLv = 7

class Skill9(PassiveSkill):
    name = '电鳗冲击'
    icon = '/character/mage_female/common/Common.img_0_10.png'
    requiredLv = 5
    masterLv = 1
    maxLv = 1
    SP = 15

    def effect(self, char:Character,addLv = 0):
        if self.lv > 0:
            if addLv == 0:
                char.GetSkillByName('光电鳗').skillRatio = 1.3

class Skill10(ActiveSkill):
    name = '替身草人'
    icon = '/character/mage_female/common/Common.img_0_7.png'
    requiredLv = 10
    rangeLv = 1
    masterLv = 1
    maxLv = 1
    SP = 20
    CD = 60

class Skill11(PassiveSkill):
    name = '元素精通'
    icon = '/character/mage_female/elementalist/ElementalMaster.img_0_2.png'
    requiredLv = 10
    SP = 20
    rangeLv = 3
    masterLv = 10
    maxLv = 20

    def effect(self, char:Character,addLv = 0):
        if self.lv > 0:
            if addLv == 0:
                char.SetStatus(技能技攻= 0.02 +  self.lv *0.01,全属抗=10)
            else:
                char.SetStatus(技能技攻= addLv *0.01)

class Skill12(ActiveSkill):
    name = '杰克降临'
    icon = '/character/mage_female/elementalist/ElementalMaster.img_0_6.png'
    requiredLv = 10
    rangeLv = 2
    masterLv = 50
    maxLv = 60
    CD = 20
    SP = 20
    data0 = [0] + [int(107 + 11 * (i-1)) for i in range(0,60)]
    hit0 = 1
    data1 = [0] + [int(1075 + 109 * (i-1)) for i in range(0,60)]
    hit1 = 1
    damageType = '魔法'
    ElementA = {'火': True}

    TPCost = 2
    growthTP  = 0.02
    masterTPLv = 5
    maxTPLv = 7

class Skill13(ActiveSkill):
    name = '烈焰冲击'
    icon = '/character/mage_female/elementalist/ElementalMaster.img_0_11.png'
    requiredLv = 15
    rangeLv = 2
    masterLv = 50
    maxLv = 60
    CD = 5
    SP = 25
    data0 = [0] + [int(497 + 50 * (i-1)) for i in range(0,60)]
    hit0 = 1

    damageType = '魔法'
    ElementA = {'火': True}

    TPCost = 2
    growthTP = 0.02
    masterTPLv = 5
    maxTPLv = 7

class Skill14(ActiveSkill):
    name = '虚无之球'
    icon = '/character/mage_female/elementalist/ElementalMaster.img_0_14.png'
    requiredLv = 20
    rangeLv = 2
    masterLv = 50
    maxLv = 60
    CD = 5
    SP = 30
    data0 = [0] + [int(55 + 6 * (i-1)) for i in range(0,60)]

    damageType = '魔法'
    ElementA = {'暗': True}

    TPCost = 2
    growthTP = 0.02
    masterTPLv = 5
    maxTPLv = 7

class Skill15(ActiveSkill):
    name = '魔法秀'
    icon = '/character/mage_female/common/Common.img_0_1.png'
    requiredLv = 20
    rangeLv = 3
    masterLv = 10
    maxLv = 20
    CD = 60
    skillDamage = False
    SP = 30

    def effect(self, char, addLv=0):
        for skill in char.skills:
            if skill.type == 1 and skill.damage and skill.damageType == '魔法':
                skill.CDR *= 1 - 0.05
        return

class Skill16(ActiveSkill):
    name = '冰墙'
    icon = '/character/mage_female/elementalist/ElementalMaster.img_0_13.png'
    requiredLv = 25
    rangeLv = 2
    masterLv = 50
    maxLv = 60
    CD = 7
    SP = 35
    data0 = [0] + [int(737 + 75 * (i-1)) for i in range(0,60)]
    hit0 = 1

    damageType = '魔法'
    ElementA = {'冰': True}

    TPCost = 2
    growthTP = 0.02
    masterTPLv = 5
    maxTPLv = 7

class Skill17(ActiveSkill):
    name = '雷旋'
    icon = '/character/mage_female/elementalist/ElementalMaster.img_0_12.png'
    requiredLv = 25
    rangeLv = 2
    masterLv = 50
    maxLv = 60
    CD = 7
    SP = 35
    data0 = [0] + [int(771 + 79 * (i-1)) for i in range(0,60)]
    hit0 = 1
    ElementA = {'光': True}

    TPCost = 2
    growthTP = 0.02
    masterTPLv = 5
    maxTPLv = 7

class Skill18(ActiveSkill):
    name = '元素点燃'
    icon = '/character/mage_female/elementalist/ElementalMaster.img_0_7.png'
    requiredLv = 25
    rangeLv = 3
    masterLv = 10
    maxLv = 20
    CD = 5
    SP = 35

    def effect(self, char, addLv=0):
        if self.lv > 0:
            if addLv == 0:
                char.SetStatus(智力= 28 + 2 * self.lv,技能技攻= 0.036 + 0.025 * self.lv)
            else:
                char.SetStatus(智力= 2 * addLv,技能技攻= 0.025 * addLv)

class Skill19(ActiveSkill):
    name = '烈焰火山'
    icon = '/character/mage_female/elementalist/ElementalMaster.img_0_15.png'
    requiredLv = 30
    rangeLv = 2
    masterLv = 50
    maxLv = 60
    CD = 20
    SP = 40
    data0 = [0] + [int(702 + 72 * (i-1)) for i in range(0,60)]
    hit0 = 1
    data1 = [0] + [int(163 + 17 * (i-1)) for i in range(0,60)]
    hit1 = 10
    data2 = [0] + [int(56 + 5 * (i-1)) for i in range(0,60)]
    hit2 = 1

    ElementA = {'火': True}
    damageType = '魔法'
    cube = 1

    TPCost = 2
    growthTP = 0.02
    masterTPLv = 5
    maxTPLv = 7

class Skill20(ActiveSkill):
    name = '天雷'
    icon = '/character/mage_female/elementalist/ElementalMaster.img_0_18.png'
    requiredLv = 35
    rangeLv = 2
    masterLv = 50
    maxLv = 60
    CD = 20
    SP = 45
    data0 = [0] + [int(903 + 91 * (i-1)) for i in range(0,60)]
    hit0 = 3

    ElementA = {'光': True}
    damageType = '魔法'
    cube = 1

    TPCost = 2
    growthTP = 0.02
    masterTPLv = 5
    maxTPLv = 7

class Skill21(PassiveSkill):
    name = '雷击'
    icon = '/character/mage_female/elementalist/ElementalMaster.img_0_1.png'
    requiredLv = 40
    masterLv = 1
    maxLv = 1
    SP = 0

    def effect(self, char, addLv=0):
        if self.lv > 0:
            if addLv == 0:
                天雷 = char.GetSkillByName('天雷')
                天雷.skillRatio *= 1.3
                天雷.CD  = 30


class Skill22(ActiveSkill):
    name = '湮灭黑洞'
    icon = '/character/mage_female/elementalist/ElementalMaster.img_0_8.png'
    requiredLv = 40
    rangeLv = 2
    masterLv = 50
    maxLv = 60
    CD = 20
    SP = 50
    data0 = [0] + [int(111 + 12 * (i-1)) for i in range(0,60)]
    hit0 = 10
    data1 = [0] + [int(1118 + 114 * (i-1)) for i in range(0,60)]
    hit1 = 1

    ElementA = {'暗': True}
    damageType = '魔法'
    cube = 1

    TPCost = 2
    growthTP = 0.02
    masterTPLv = 5
    maxTPLv = 7

class Skill23(ActiveSkill):
    name = '极冰盛宴'
    icon = '/character/mage_female/elementalist/ElementalMaster.img_0_9.png'
    requiredLv = 45
    rangeLv = 2
    masterLv = 50
    maxLv = 60
    CD = 40
    SP = 55
    data0 = [0] + [int(624 + 63 * (i-1)) for i in range(0,60)]
    hit0 = 8

    ElementA = {'冰': True}
    damageType = '魔法'
    cube = 5

    TPCost = 2
    growthTP = 0.02
    masterTPLv = 5
    maxTPLv = 7

class Skill24(ActiveSkill):
    name = '陨星幻灭'
    icon = '/character/mage_female/elementalist/ElementalMaster.img_0_10.png'
    requiredLv = 50
    rangeLv = 5
    masterLv = 50
    maxLv = 60
    CD = 145
    SP = 100
    data0 = [0] + [int(211 + 49 * (i-1)) for i in range(0,60)]
    hit0 = 35
    data1 = [0] + [int(4224 + 979 * (i-1)) for i in range(0,60)]
    hit1 = 1
    data2 = [0] + [int(1469 + 109 * (i-1)) for i in range(0,60)]
    hit2 = 1

    ElementA = {'火': True, '冰': True, '光': True, '暗': True}
    damageType = '魔法'
    cube = 5

class Skill25(PassiveSkill):
    name = '元素集中'
    icon = '/character/mage_female/elementalist/ElementalMaster.img_0_16.png'
    requiredLv = 50
    rangeLv = 3
    masterLv = 10
    maxLv = 20
    SP = 45

    def effect(self, char:Character, addLv=0):
        if self.lv > 0:
            if addLv == 0:
                char.SetStatus(魔攻P= 0.065 +  self.lv *0.005,魔暴P=0.030 + 0.005*self.lv)
            else:
                char.SetStatus(魔攻P= 0.005 * addLv,魔暴P=0.005 * addLv)

# class Skill12(ActiveSkill):
# 50 35+1+1


class classChange(Character):
    def __init__(self, equVersion=""):
        self.实际名称 = 'elementalist'
        self.名称 = '元素师'
        self.角色 = '魔法师(女)'
        self.职业 = '元素师'
        self.武器选项 = ['魔杖', '法杖']
        self.输出类型 = '魔法'
        self.武器类型 = '魔杖'
        self.防具类型 = '布甲'
        self.异界 = '幻雨彩晶'

        skills = []
        skillsWithName = {}
        i = 0
        while i >= 0:
            try:
                tem : Union[ActiveSkill,PassiveSkill] = eval('Skill'+str(i)+'()')
                skillsWithName[tem.name] = i
                skills.append(tem)
                i += 1
            except Exception:
                i = -1

        self.skills = skills
        self.skillsWithName = skillsWithName

        super().__init__(equVersion)

